<!--
 * @Author: heyang
 * @Date: 2024-12-31 14:51:02
 * @LastEditors: heyang
 * @LastEditTime: 2025-01-06 15:55:47
 * @FilePath: \eng-proc-mgt-sys\src\views\welcome\index.vue
 * @Description: 
 * 
 * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. 
-->
<script setup lang="ts">
import { reactive, ref, shallowRef } from "vue";
import { useRole } from "./utils/hook";
import { useRenderIcon } from "@/components/ReIcon/src/hooks";
import { AgGridVue } from "ag-grid-vue3";
import { GridApi, GridReadyEvent } from "ag-grid-enterprise";
defineOptions({
  name: "Welcome"
});
const { columns, onEdit, onSave, editMap, onCancel } = useRole();
const rowData = ref([
  { make: "Tesla", model: "Model Y", price: 64950, electric: true },
  { make: "Ford", model: "F-Series", price: 33850, electric: false },
  { make: "Toyota", model: "Corolla", price: 29600, electric: false }
]);

// Column Definitions: Defines the columns to be displayed.
const colDefs = ref([
  { field: "make", headerName: "接件时间", editable: true, pinned: "left" },
  { field: "model", headerName: "委托单位", editable: true },
  { field: "price", headerName: "业务联系人", editable: true },
  { field: "electric", headerName: "联系人电话", editable: true },
  { field: "electric", headerName: "联系人单位", editable: true },
  { field: "electric", headerName: "业务类型", editable: true },
  { field: "electric", headerName: "接受时送审金额", editable: true }
]);

const form = reactive({
  name: "",
  code: "",
  status: ""
});

const gridApi = shallowRef(null);

const onGridReady = (params: GridReadyEvent) => {
  // gridApi.value = params.api;

  const updateData = data => (rowData.value = data);
};
</script>

<template>
  <div>
    <el-form
      ref="formRef"
      :inline="true"
      :model="form"
      class="search-form bg-bg_color w-[99/100] pl-8 pt-[12px] overflow-auto mb-4"
    >
      <el-form-item label="接受时间：" prop="name">
        <el-date-picker
          v-model="form.name"
          type="date"
          placeholder="选择日期"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" :icon="useRenderIcon('ri:search-line')">
          搜索
        </el-button>
        <!-- <el-button :icon="useRenderIcon(Refresh)" @click="resetForm(formRef)">
          重置
        </el-button> -->
      </el-form-item>
    </el-form>
    <div class="mb-4">
      <el-card shadow="always">
        <p class="mb-4">当前进度：已到达二级复核</p>
        <el-progress :percentage="50" class="mb-4 w-96" />
      </el-card>
    </div>
    <ag-grid-vue
      :rowData="rowData"
      :columnDefs="colDefs"
      style="height: 400px"
      @grid-ready="onGridReady"
      :enableRangeSelection="true"
      :enableFillHandle="true"
      :fillHandleDirection="'xy'"
      :rowSelection="{
        mode: 'multiRow'
      }"
    >
    </ag-grid-vue>
  </div>
</template>
